//
// 消息接收处理层，管理队列和处理逻辑
// Created by kenny on 25-10-30.
//
#ifndef PACKET_PROCESSOR_H
#define PACKET_PROCESSOR_H
#include "mcp_queue.h"
#include "mcp_decode.h"
#include <stdint.h>


#ifdef __cplusplus
extern "C" {
#endif
    // 回调函数类型定义
    typedef void (*packet_callback_t)(const char* message, uint8_t resp_protocol,uint16_t resp_sequence);

    // 处理器结构体
    typedef struct packet_processor_t packet_processor_t;

    // 创建处理器
    packet_processor_t* packet_processor_create(int queue_capacity, packet_callback_t callback);
    // 销毁处理器
    void packet_processor_destroy(packet_processor_t* processor);
    // 启动处理
    void packet_processor_start(packet_processor_t* processor);
    // 停止处理
    void packet_processor_stop(packet_processor_t* processor);
    // 添加数据包到处理器
    int packet_processor_add_packet(packet_processor_t* processor, const CustomPacket* packet);
    // 检查处理器是否正在运行
    int packet_processor_is_running(const packet_processor_t* processor);

#ifdef __cplusplus
}
#endif
#endif //PACKET_PROCESSOR_H
